package com.ruoyi.deeplearn.service.impl;

import java.util.List;

import cn.hutool.core.util.IdUtil;
import com.ruoyi.deeplearn.domain.DatasetFileTag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.deeplearn.mapper.DeepDatasetMarkMapper;
import com.ruoyi.deeplearn.domain.DeepDatasetMark;
import com.ruoyi.deeplearn.service.IDeepDatasetMarkService;

/**
 * 标记Service业务层处理
 * 
 * @author rww
 * @date 2022-12-11
 */
@Service
public class DeepDatasetMarkServiceImpl implements IDeepDatasetMarkService 
{
    @Autowired
    private DeepDatasetMarkMapper deepDatasetMarkMapper;

    /**
     * 查询标记
     * 
     * @param markId 标记主键
     * @return 标记
     */
    @Override
    public DeepDatasetMark selectDeepDatasetMarkByMarkId(Long markId)
    {
        return deepDatasetMarkMapper.selectDeepDatasetMarkByMarkId(markId);
    }

    /**
     * 查询标记列表
     * 
     * @param deepDatasetMark 标记
     * @return 标记
     */
    @Override
    public List<DeepDatasetMark> selectDeepDatasetMarkList(DeepDatasetMark deepDatasetMark)
    {
        return deepDatasetMarkMapper.selectDeepDatasetMarkList(deepDatasetMark);
    }

    /**
     * 新增标记
     * 
     * @param deepDatasetMark 标记
     * @return 结果
     */
    @Override
    public int insertDeepDatasetMark(DeepDatasetMark deepDatasetMark)
    {
        deepDatasetMark.setMarkId(IdUtil.getSnowflakeNextId());
        return deepDatasetMarkMapper.insertDeepDatasetMark(deepDatasetMark);
    }

    /**
     * 修改标记
     * 
     * @param deepDatasetMark 标记
     * @return 结果
     */
    @Override
    public int updateDeepDatasetMark(DeepDatasetMark deepDatasetMark)
    {
        return deepDatasetMarkMapper.updateDeepDatasetMark(deepDatasetMark);
    }

    /**
     * 批量删除标记
     * 
     * @param markIds 需要删除的标记主键
     * @return 结果
     */
    @Override
    public int deleteDeepDatasetMarkByMarkIds(Long[] markIds)
    {
        return deepDatasetMarkMapper.deleteDeepDatasetMarkByMarkIds(markIds);
    }

    /**
     * 删除标记信息
     * 
     * @param markId 标记主键
     * @return 结果
     */
    @Override
    public int deleteDeepDatasetMarkByMarkId(Long markId)
    {
        return deepDatasetMarkMapper.deleteDeepDatasetMarkByMarkId(markId);
    }

    @Override
    public List<DatasetFileTag> groupFileTagByFileId(Long fileId) {
        return deepDatasetMarkMapper.groupFileTagByFileId(fileId);
    }
}
